{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 26,
   "metadata": {},
   "outputs": [],
   "source": [
    "import sqlite3\n",
    "from attributesDir.attributesDir import adoc, aprint, classify"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 打开数据库连接"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 16,
   "metadata": {},
   "outputs": [],
   "source": [
    "# To use the module, start by creating a Connection object that represents the database. \n",
    "# Here the data will be stored in the example.db file:\n",
    "con = sqlite3.connect(\"example.db\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [],
   "source": [
    "# The special path name :memory: can be provided to create a temporary database in RAM.\n",
    "con = sqlite3.connect(\":memory:\")"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 使用crusor()方法创建一个游标对象cursor"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 17,
   "metadata": {},
   "outputs": [],
   "source": [
    "cur = con.cursor()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 使用execute()方法执行SQL查询"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 19,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "<sqlite3.Cursor at 0x14d46a9d260>"
      ]
     },
     "execution_count": 19,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# Create table\n",
    "cur.execute('''CREATE TABLE stocks\n",
    "               (date text, trans text, symbol text, qty real, price real)''')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 20,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "<sqlite3.Cursor at 0x14d46a9d260>"
      ]
     },
     "execution_count": 20,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# Insert a row of data\n",
    "cur.execute(\"\"\"INSERT INTO stocks (date, trans, symbol, qty, price)\n",
    "                        VALUES ('2006-01-05','BUY','RHAT',100,35.14),\n",
    "                        ('2006-01-05', 'BUY', 'RHAT', 100, 35.14),\n",
    "                        ('2006-03-28', 'BUY', 'IBM', 1000, 45.0),\n",
    "                        ('2006-04-06', 'SELL', 'IBM', 500, 53.0),\n",
    "                        ('2006-04-05', 'BUY', 'MSFT', 1000, 72.0)\"\"\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 21,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "[('2006-01-05', 'BUY', 'RHAT', 100.0, 35.14),\n",
       " ('2006-01-05', 'BUY', 'RHAT', 100.0, 35.14),\n",
       " ('2006-03-28', 'BUY', 'IBM', 1000.0, 45.0),\n",
       " ('2006-04-06', 'SELL', 'IBM', 500.0, 53.0),\n",
       " ('2006-04-05', 'BUY', 'MSFT', 1000.0, 72.0)]"
      ]
     },
     "execution_count": 21,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# fetch all rows of data\n",
    "cur.execute(\"SELECT * FROM Stocks;\")\n",
    "\n",
    "cur.fetchall()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 22,
   "metadata": {},
   "outputs": [],
   "source": [
    "# Save (commit) the changes\n",
    "con.commit()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 23,
   "metadata": {},
   "outputs": [],
   "source": [
    "cur.close()\n",
    "con.close()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 使用 DB-API 的参数替换"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "# Never do this -- insecure!\n",
    "symbol = 'RHAT'\n",
    "cur.execute(\"SELECT * FROM stocks WHERE symbol = '%s'\" % symbol)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "相反，应该使用 DB-API 的参数替换。\n",
    "\n",
    "要将变量插入到查询字符串中，请在字符串中使用占位符，并将实际值作为一组值提供给游标的 execute ()方法的第二个参数，以此替代查询中的实际值。\n",
    "\n",
    "SQL 语句可以使用两种占位符之一: 问号(qmark 样式)或命名占位符(命名样式)。\n",
    "\n",
    "对于 qmark 样式，参数必须是一个序列。对于命名样式，它可以是序列或者 dict 实例。\n",
    "\n",
    "\n",
    "\n",
    "paramstyle\n",
    "\n",
    "String constant stating the type of parameter marker formatting expected by the interface. Possible values are [2]:\n",
    "\n",
    "|paramstyle|\tMeaning|\n",
    "|---|---|\n",
    "|qmark\t|Question mark style, e.g. ...WHERE <font color=red size=6>name=?</font>|\n",
    "|numeric|\tNumeric, positional style, e.g. ...WHERE name=:1|\n",
    "|named\t|Named style, e.g. ...WHERE <font color=red size=6>name=:name</font>\n",
    "|\n",
    "|format\t|ANSI C printf format codes, e.g. ...WHERE name=%s|\n",
    "|pyformat|\tPython extended format codes, e.g. ...WHERE name=%(name)s|"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 25,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[('C', 1972)]\n"
     ]
    }
   ],
   "source": [
    "import sqlite3\n",
    "\n",
    "con = sqlite3.connect(\":memory:\")\n",
    "\n",
    "cur = con.cursor()\n",
    "\n",
    "cur.execute(\"CREATE TABLE Lang (name, first_appeared)\")\n",
    "\n",
    "# This is the qmark style:\n",
    "cur.execute(\"INSERT INTO Lang VALUES (?, ?)\", (\"C\",  1972))\n",
    "\n",
    "# The qmark style used with executemany():\n",
    "lang_list = [\n",
    "    (\"Fortran\", 1957),\n",
    "    (\"Python\", 1991),\n",
    "    (\"Go\", 2009),\n",
    "]\n",
    "cur.executemany(\"INSERT INTO Lang VALUES (?, ?)\", lang_list)\n",
    "\n",
    "# And this is the named style:\n",
    "cur.execute(\"SELECT * FROM Lang WHERE first_appeared=:year\", {\"year\": 1972})\n",
    "\n",
    "print(cur.fetchall())\n",
    "\n",
    "\n",
    "cur.close()\n",
    "con.close()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# 模块函数和常量"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 32,
   "metadata": {
    "scrolled": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "\u001b[41m                     classess                     \u001b[0m\n",
      "\u001b[41m001\u001b[0m Binary                        \u001b[41m002\u001b[0m Cache                         \u001b[41m003\u001b[0m Connection                    \u001b[41m004\u001b[0m Cursor                        \n",
      "\u001b[41m005\u001b[0m DataError                     \u001b[41m006\u001b[0m DatabaseError                 \u001b[41m007\u001b[0m Date                          \u001b[41m008\u001b[0m Error                         \n",
      "\u001b[41m009\u001b[0m IntegrityError                \u001b[41m010\u001b[0m InterfaceError                \u001b[41m011\u001b[0m InternalError                 \u001b[41m012\u001b[0m NotSupportedError             \n",
      "\u001b[41m013\u001b[0m OperationalError              \u001b[41m014\u001b[0m OptimizedUnicode              \u001b[41m015\u001b[0m PrepareProtocol               \u001b[41m016\u001b[0m ProgrammingError              \n",
      "\u001b[41m017\u001b[0m Row                           \u001b[41m018\u001b[0m Statement                     \u001b[41m019\u001b[0m Time                          \u001b[41m020\u001b[0m Timestamp                     \n",
      "\u001b[41m021\u001b[0m Warning                       \n",
      "\u001b[41m               function_or_methods                \u001b[0m\n",
      "\u001b[41m001\u001b[0m DateFromTicks                 \u001b[41m002\u001b[0m TimeFromTicks                 \u001b[41m003\u001b[0m TimestampFromTicks            \u001b[41m004\u001b[0m adapt                         \n",
      "\u001b[41m005\u001b[0m complete_statement            \u001b[41m006\u001b[0m connect                       \u001b[41m007\u001b[0m enable_callback_tracebacks    \u001b[41m008\u001b[0m enable_shared_cache           \n",
      "\u001b[41m009\u001b[0m register_adapter              \u001b[41m010\u001b[0m register_converter            \n",
      "\u001b[41m                    constants                     \u001b[0m\n",
      "\u001b[41m001\u001b[0m PARSE_COLNAMES                \u001b[41m002\u001b[0m PARSE_DECLTYPES               \u001b[41m003\u001b[0m SQLITE_ALTER_TABLE            \u001b[41m004\u001b[0m SQLITE_ANALYZE                \n",
      "\u001b[41m005\u001b[0m SQLITE_ATTACH                 \u001b[41m006\u001b[0m SQLITE_CREATE_INDEX           \u001b[41m007\u001b[0m SQLITE_CREATE_TABLE           \u001b[41m008\u001b[0m SQLITE_CREATE_TEMP_INDEX      \n",
      "\u001b[41m009\u001b[0m SQLITE_CREATE_TEMP_TABLE      \u001b[41m010\u001b[0m SQLITE_CREATE_TEMP_TRIGGER    \u001b[41m011\u001b[0m SQLITE_CREATE_TEMP_VIEW       \u001b[41m012\u001b[0m SQLITE_CREATE_TRIGGER         \n",
      "\u001b[41m013\u001b[0m SQLITE_CREATE_VIEW            \u001b[41m014\u001b[0m SQLITE_CREATE_VTABLE          \u001b[41m015\u001b[0m SQLITE_DELETE                 \u001b[41m016\u001b[0m SQLITE_DENY                   \n",
      "\u001b[41m017\u001b[0m SQLITE_DETACH                 \u001b[41m018\u001b[0m SQLITE_DONE                   \u001b[41m019\u001b[0m SQLITE_DROP_INDEX             \u001b[41m020\u001b[0m SQLITE_DROP_TABLE             \n",
      "\u001b[41m021\u001b[0m SQLITE_DROP_TEMP_INDEX        \u001b[41m022\u001b[0m SQLITE_DROP_TEMP_TABLE        \u001b[41m023\u001b[0m SQLITE_DROP_TEMP_TRIGGER      \u001b[41m024\u001b[0m SQLITE_DROP_TEMP_VIEW         \n",
      "\u001b[41m025\u001b[0m SQLITE_DROP_TRIGGER           \u001b[41m026\u001b[0m SQLITE_DROP_VIEW              \u001b[41m027\u001b[0m SQLITE_DROP_VTABLE            \u001b[41m028\u001b[0m SQLITE_FUNCTION               \n",
      "\u001b[41m029\u001b[0m SQLITE_IGNORE                 \u001b[41m030\u001b[0m SQLITE_INSERT                 \u001b[41m031\u001b[0m SQLITE_OK                     \u001b[41m032\u001b[0m SQLITE_PRAGMA                 \n",
      "\u001b[41m033\u001b[0m SQLITE_READ                   \u001b[41m034\u001b[0m SQLITE_RECURSIVE              \u001b[41m035\u001b[0m SQLITE_REINDEX                \u001b[41m036\u001b[0m SQLITE_SAVEPOINT              \n",
      "\u001b[41m037\u001b[0m SQLITE_SELECT                 \u001b[41m038\u001b[0m SQLITE_TRANSACTION            \u001b[41m039\u001b[0m SQLITE_UPDATE                 \u001b[41m040\u001b[0m adapters                      \n",
      "\u001b[41m041\u001b[0m apilevel                      \u001b[41m042\u001b[0m converters                    \u001b[41m043\u001b[0m paramstyle                    \u001b[41m044\u001b[0m sqlite_version                \n",
      "\u001b[41m045\u001b[0m sqlite_version_info           \u001b[41m046\u001b[0m threadsafety                  \u001b[41m047\u001b[0m version                       \u001b[41m048\u001b[0m version_info                  \n",
      "\n",
      "\n"
     ]
    }
   ],
   "source": [
    "aprint(classify(sqlite3))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 33,
   "metadata": {
    "scrolled": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "\u001b[41msqlite3\u001b[0m None\n",
      "\u001b[41m                     classess                     \u001b[0m\n",
      "\u001b[42mBinary\u001b[0m\n",
      "    Create a new memoryview object which references the given object.\n",
      "\u001b[42mCache\u001b[0m\n",
      "\n",
      "\u001b[42mConnection\u001b[0m\n",
      "    SQLite database connection object.\n",
      "\u001b[42mCursor\u001b[0m\n",
      "    SQLite database cursor class.\n",
      "\u001b[42mDataError\u001b[0m\n",
      "\n",
      "\u001b[42mDatabaseError\u001b[0m\n",
      "\n",
      "\u001b[42mDate\u001b[0m\n",
      "    date(year, month, day) --> date object\n",
      "\u001b[42mError\u001b[0m\n",
      "\n",
      "\u001b[42mIntegrityError\u001b[0m\n",
      "\n",
      "\u001b[42mInterfaceError\u001b[0m\n",
      "\n",
      "\u001b[42mInternalError\u001b[0m\n",
      "\n",
      "\u001b[42mNotSupportedError\u001b[0m\n",
      "\n",
      "\u001b[42mOperationalError\u001b[0m\n",
      "\n",
      "\u001b[42mOptimizedUnicode\u001b[0m\n",
      "    str(object='') -> str\n",
      "    str(bytes_or_buffer[, encoding[, errors]]) -> str\n",
      "\n",
      "    Create a new string object from the given object. If encoding or\n",
      "    errors is specified, then the object must expose a data buffer\n",
      "    that will be decoded using the given encoding and error handler.\n",
      "    Otherwise, returns the result of object.__str__() (if defined)\n",
      "    or repr(object).\n",
      "    encoding defaults to sys.getdefaultencoding().\n",
      "    errors defaults to 'strict'.\n",
      "\u001b[42mPrepareProtocol\u001b[0m\n",
      "\n",
      "\u001b[42mProgrammingError\u001b[0m\n",
      "\n",
      "\u001b[42mRow\u001b[0m\n",
      "\n",
      "\u001b[42mStatement\u001b[0m\n",
      "\n",
      "\u001b[42mTime\u001b[0m\n",
      "    time([hour[, minute[, second[, microsecond[, tzinfo]]]]]) --> a time object\n",
      "\n",
      "    All arguments are optional. tzinfo may be None, or an instance of\n",
      "    a tzinfo subclass. The remaining arguments may be ints.\n",
      "\n",
      "\u001b[42mTimestamp\u001b[0m\n",
      "    datetime(year, month, day[, hour[, minute[, second[, microsecond[,tzinfo]]]]])\n",
      "\n",
      "    The year, month and day arguments are required. tzinfo may be None, or an\n",
      "    instance of a tzinfo subclass. The remaining arguments may be ints.\n",
      "\n",
      "\u001b[42mWarning\u001b[0m\n",
      "\n",
      "\u001b[41m               function_or_methods                \u001b[0m\n",
      "\u001b[42mDateFromTicks\u001b[0m\n",
      "\n",
      "\u001b[42mTimeFromTicks\u001b[0m\n",
      "\n",
      "\u001b[42mTimestampFromTicks\u001b[0m\n",
      "\n",
      "\u001b[42madapt\u001b[0m\n",
      "    adapt(obj, protocol, alternate) -> adapt obj to given protocol. Non-standard.\n",
      "\u001b[42mcomplete_statement\u001b[0m\n",
      "    complete_statement(sql)\n",
      "\n",
      "    Checks if a string contains a complete SQL statement. Non-standard.\n",
      "\u001b[42mconnect\u001b[0m\n",
      "    connect(database[, timeout, detect_types, isolation_level,\n",
      "            check_same_thread, factory, cached_statements, uri])\n",
      "\n",
      "    Opens a connection to the SQLite database file *database*. You can use\n",
      "    \":memory:\" to open a database connection to a database that resides in\n",
      "    RAM instead of on disk.\n",
      "\u001b[42menable_callback_tracebacks\u001b[0m\n",
      "    enable_callback_tracebacks(flag)\n",
      "\n",
      "    Enable or disable callback functions throwing errors to stderr.\n",
      "\u001b[42menable_shared_cache\u001b[0m\n",
      "    enable_shared_cache(do_enable)\n",
      "\n",
      "    Enable or disable shared cache mode for the calling thread.\n",
      "    Experimental/Non-standard.\n",
      "\u001b[42mregister_adapter\u001b[0m\n",
      "    register_adapter(type, callable)\n",
      "\n",
      "    Registers an adapter with pysqlite's adapter registry. Non-standard.\n",
      "\u001b[42mregister_converter\u001b[0m\n",
      "    register_converter(typename, callable)\n",
      "\n",
      "    Registers a converter with pysqlite. Non-standard.\n",
      "\u001b[41m                    constants                     \u001b[0m\n",
      "\u001b[42mPARSE_COLNAMES\u001b[0m\n",
      "    2\n",
      "\u001b[42mPARSE_DECLTYPES\u001b[0m\n",
      "    1\n",
      "\u001b[42mSQLITE_ALTER_TABLE\u001b[0m\n",
      "    26\n",
      "\u001b[42mSQLITE_ANALYZE\u001b[0m\n",
      "    28\n",
      "\u001b[42mSQLITE_ATTACH\u001b[0m\n",
      "    24\n",
      "\u001b[42mSQLITE_CREATE_INDEX\u001b[0m\n",
      "    1\n",
      "\u001b[42mSQLITE_CREATE_TABLE\u001b[0m\n",
      "    2\n",
      "\u001b[42mSQLITE_CREATE_TEMP_INDEX\u001b[0m\n",
      "    3\n",
      "\u001b[42mSQLITE_CREATE_TEMP_TABLE\u001b[0m\n",
      "    4\n",
      "\u001b[42mSQLITE_CREATE_TEMP_TRIGGER\u001b[0m\n",
      "    5\n",
      "\u001b[42mSQLITE_CREATE_TEMP_VIEW\u001b[0m\n",
      "    6\n",
      "\u001b[42mSQLITE_CREATE_TRIGGER\u001b[0m\n",
      "    7\n",
      "\u001b[42mSQLITE_CREATE_VIEW\u001b[0m\n",
      "    8\n",
      "\u001b[42mSQLITE_CREATE_VTABLE\u001b[0m\n",
      "    29\n",
      "\u001b[42mSQLITE_DELETE\u001b[0m\n",
      "    9\n",
      "\u001b[42mSQLITE_DENY\u001b[0m\n",
      "    1\n",
      "\u001b[42mSQLITE_DETACH\u001b[0m\n",
      "    25\n",
      "\u001b[42mSQLITE_DONE\u001b[0m\n",
      "    101\n",
      "\u001b[42mSQLITE_DROP_INDEX\u001b[0m\n",
      "    10\n",
      "\u001b[42mSQLITE_DROP_TABLE\u001b[0m\n",
      "    11\n",
      "\u001b[42mSQLITE_DROP_TEMP_INDEX\u001b[0m\n",
      "    12\n",
      "\u001b[42mSQLITE_DROP_TEMP_TABLE\u001b[0m\n",
      "    13\n",
      "\u001b[42mSQLITE_DROP_TEMP_TRIGGER\u001b[0m\n",
      "    14\n",
      "\u001b[42mSQLITE_DROP_TEMP_VIEW\u001b[0m\n",
      "    15\n",
      "\u001b[42mSQLITE_DROP_TRIGGER\u001b[0m\n",
      "    16\n",
      "\u001b[42mSQLITE_DROP_VIEW\u001b[0m\n",
      "    17\n",
      "\u001b[42mSQLITE_DROP_VTABLE\u001b[0m\n",
      "    30\n",
      "\u001b[42mSQLITE_FUNCTION\u001b[0m\n",
      "    31\n",
      "\u001b[42mSQLITE_IGNORE\u001b[0m\n",
      "    2\n",
      "\u001b[42mSQLITE_INSERT\u001b[0m\n",
      "    18\n",
      "\u001b[42mSQLITE_OK\u001b[0m\n",
      "    0\n",
      "\u001b[42mSQLITE_PRAGMA\u001b[0m\n",
      "    19\n",
      "\u001b[42mSQLITE_READ\u001b[0m\n",
      "    20\n",
      "\u001b[42mSQLITE_RECURSIVE\u001b[0m\n",
      "    33\n",
      "\u001b[42mSQLITE_REINDEX\u001b[0m\n",
      "    27\n",
      "\u001b[42mSQLITE_SAVEPOINT\u001b[0m\n",
      "    32\n",
      "\u001b[42mSQLITE_SELECT\u001b[0m\n",
      "    21\n",
      "\u001b[42mSQLITE_TRANSACTION\u001b[0m\n",
      "    22\n",
      "\u001b[42mSQLITE_UPDATE\u001b[0m\n",
      "    23\n",
      "\u001b[42madapters\u001b[0m\n",
      "    {(<class 'datetime.date'>, <class 'sqlite3.PrepareProtocol'>): <function register_adapters_and_converters.<locals>.adapt_date at 0x0000014D439C1D90>, (<class 'datetime.datetime'>, <class 'sqlite3.PrepareProtocol'>): <function register_adapters_and_converters.<locals>.adapt_datetime at 0x0000014D439C1E18>}\n",
      "\u001b[42mapilevel\u001b[0m\n",
      "    '2.0'\n",
      "\u001b[42mconverters\u001b[0m\n",
      "    {'DATE': <function register_adapters_and_converters.<locals>.convert_date at 0x0000014D439C1EA0>, 'TIMESTAMP': <function register_adapters_and_converters.<locals>.convert_timestamp at 0x0000014D439C1F28>}\n",
      "\u001b[42mparamstyle\u001b[0m\n",
      "    'qmark'\n",
      "\u001b[42msqlite_version\u001b[0m\n",
      "    '3.27.2'\n",
      "\u001b[42msqlite_version_info\u001b[0m\n",
      "    (3, 27, 2)\n",
      "\u001b[42mthreadsafety\u001b[0m\n",
      "    1\n",
      "\u001b[42mversion\u001b[0m\n",
      "    '2.6.0'\n",
      "\u001b[42mversion_info\u001b[0m\n",
      "    (2, 6, 0)\n",
      "None\n",
      "\n"
     ]
    }
   ],
   "source": [
    "aprint(adoc(sqlite3))"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# methods and attributes"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 27,
   "metadata": {},
   "outputs": [],
   "source": [
    "con = sqlite3.connect(\"example.db\")\n",
    "cur = con.cursor()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## connection"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### aprint(classify(con))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 28,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "If it is a callable object then you can assign a __name__ attribute to it.\n",
      "But the value assigned to __name__ must be the name of the callable object.\n",
      "If it is a callable object then you can assign a __name__ attribute to it.\n",
      "But the value assigned to __name__ must be the name of the callable object.\n",
      "If it is a callable object then you can assign a __name__ attribute to it.\n",
      "But the value assigned to __name__ must be the name of the callable object.\n",
      "\u001b[41m                     classess                     \u001b[0m\n",
      "\u001b[41m001\u001b[0m DataError                     \u001b[41m002\u001b[0m DatabaseError                 \u001b[41m003\u001b[0m Error                         \u001b[41m004\u001b[0m IntegrityError                \n",
      "\u001b[41m005\u001b[0m InterfaceError                \u001b[41m006\u001b[0m InternalError                 \u001b[41m007\u001b[0m NotSupportedError             \u001b[41m008\u001b[0m OperationalError              \n",
      "\u001b[41m009\u001b[0m ProgrammingError              \u001b[41m010\u001b[0m Warning                       \u001b[41m011\u001b[0m text_factory                  \n",
      "\u001b[41m               function_or_methods                \u001b[0m\n",
      "\u001b[41m001\u001b[0m backup                        \u001b[41m002\u001b[0m close                         \u001b[41m003\u001b[0m commit                        \u001b[41m004\u001b[0m create_aggregate              \n",
      "\u001b[41m005\u001b[0m create_collation              \u001b[41m006\u001b[0m create_function               \u001b[41m007\u001b[0m cursor                        \u001b[41m008\u001b[0m enable_load_extension         \n",
      "\u001b[41m009\u001b[0m execute                       \u001b[41m010\u001b[0m executemany                   \u001b[41m011\u001b[0m executescript                 \u001b[41m012\u001b[0m interrupt                     \n",
      "\u001b[41m013\u001b[0m iterdump                      \u001b[41m014\u001b[0m load_extension                \u001b[41m015\u001b[0m rollback                      \u001b[41m016\u001b[0m set_authorizer                \n",
      "\u001b[41m017\u001b[0m set_progress_handler          \u001b[41m018\u001b[0m set_trace_callback            \n",
      "\u001b[41m                    constants                     \u001b[0m\n",
      "\u001b[41m001\u001b[0m in_transaction                \u001b[41m002\u001b[0m isolation_level               \u001b[41m003\u001b[0m row_factory                   \u001b[41m004\u001b[0m total_changes                 \n",
      "\n",
      "\n"
     ]
    }
   ],
   "source": [
    "aprint(classify(con))"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### aprint(adoc(con))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 29,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "If it is a callable object then you can assign a __name__ attribute to it.\n",
      "But the value assigned to __name__ must be the name of the callable object.\n",
      "If it is a callable object then you can assign a __name__ attribute to it.\n",
      "But the value assigned to __name__ must be the name of the callable object.\n",
      "If it is a callable object then you can assign a __name__ attribute to it.\n",
      "But the value assigned to __name__ must be the name of the callable object.\n",
      "\u001b[41m<sqlite3.Connection object at 0x0000014D483FDB90>\u001b[0m SQLite database connection object.\n",
      "\u001b[41m                     classess                     \u001b[0m\n",
      "\u001b[42mDataError\u001b[0m\n",
      "\n",
      "\u001b[42mDatabaseError\u001b[0m\n",
      "\n",
      "\u001b[42mError\u001b[0m\n",
      "\n",
      "\u001b[42mIntegrityError\u001b[0m\n",
      "\n",
      "\u001b[42mInterfaceError\u001b[0m\n",
      "\n",
      "\u001b[42mInternalError\u001b[0m\n",
      "\n",
      "\u001b[42mNotSupportedError\u001b[0m\n",
      "\n",
      "\u001b[42mOperationalError\u001b[0m\n",
      "\n",
      "\u001b[42mProgrammingError\u001b[0m\n",
      "\n",
      "\u001b[42mWarning\u001b[0m\n",
      "\n",
      "\u001b[42mtext_factory\u001b[0m\n",
      "    str(object='') -> str\n",
      "    str(bytes_or_buffer[, encoding[, errors]]) -> str\n",
      "\n",
      "    Create a new string object from the given object. If encoding or\n",
      "    errors is specified, then the object must expose a data buffer\n",
      "    that will be decoded using the given encoding and error handler.\n",
      "    Otherwise, returns the result of object.__str__() (if defined)\n",
      "    or repr(object).\n",
      "    encoding defaults to sys.getdefaultencoding().\n",
      "    errors defaults to 'strict'.\n",
      "\u001b[41m               function_or_methods                \u001b[0m\n",
      "\u001b[42mbackup\u001b[0m\n",
      "    Makes a backup of the database. Non-standard.\n",
      "\u001b[42mclose\u001b[0m\n",
      "    Closes the connection.\n",
      "\u001b[42mcommit\u001b[0m\n",
      "    Commit the current transaction.\n",
      "\u001b[42mcreate_aggregate\u001b[0m\n",
      "    Creates a new aggregate. Non-standard.\n",
      "\u001b[42mcreate_collation\u001b[0m\n",
      "    Creates a collation function. Non-standard.\n",
      "\u001b[42mcreate_function\u001b[0m\n",
      "    Creates a new function. Non-standard.\n",
      "\u001b[42mcursor\u001b[0m\n",
      "    Return a cursor for the connection.\n",
      "\u001b[42menable_load_extension\u001b[0m\n",
      "    Enable dynamic loading of SQLite extension modules. Non-standard.\n",
      "\u001b[42mexecute\u001b[0m\n",
      "    Executes a SQL statement. Non-standard.\n",
      "\u001b[42mexecutemany\u001b[0m\n",
      "    Repeatedly executes a SQL statement. Non-standard.\n",
      "\u001b[42mexecutescript\u001b[0m\n",
      "    Executes a multiple SQL statements at once. Non-standard.\n",
      "\u001b[42minterrupt\u001b[0m\n",
      "    Abort any pending database operation. Non-standard.\n",
      "\u001b[42miterdump\u001b[0m\n",
      "    Returns iterator to the dump of the database in an SQL text format. Non-standard.\n",
      "\u001b[42mload_extension\u001b[0m\n",
      "    Load SQLite extension module. Non-standard.\n",
      "\u001b[42mrollback\u001b[0m\n",
      "    Roll back the current transaction.\n",
      "\u001b[42mset_authorizer\u001b[0m\n",
      "    Sets authorizer callback. Non-standard.\n",
      "\u001b[42mset_progress_handler\u001b[0m\n",
      "    Sets progress handler callback. Non-standard.\n",
      "\u001b[42mset_trace_callback\u001b[0m\n",
      "    Sets a trace callback called for each SQL statement (passed as unicode). Non-standard.\n",
      "\u001b[41m                    constants                     \u001b[0m\n",
      "\u001b[42min_transaction\u001b[0m\n",
      "    False\n",
      "\u001b[42misolation_level\u001b[0m\n",
      "    ''\n",
      "\u001b[42mrow_factory\u001b[0m\n",
      "    None\n",
      "\u001b[42mtotal_changes\u001b[0m\n",
      "    0\n",
      "None\n",
      "\n"
     ]
    }
   ],
   "source": [
    "aprint(adoc(con))"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## cursor"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### aprint(classify(cur))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 30,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "If it is a callable object then you can assign a __name__ attribute to it.\n",
      "But the value assigned to __name__ must be the name of the callable object.\n",
      "If it is a callable object then you can assign a __name__ attribute to it.\n",
      "But the value assigned to __name__ must be the name of the callable object.\n",
      "If it is a callable object then you can assign a __name__ attribute to it.\n",
      "But the value assigned to __name__ must be the name of the callable object.\n",
      "\u001b[41m                     classess                     \u001b[0m\n",
      "\n",
      "\u001b[41m               function_or_methods                \u001b[0m\n",
      "\u001b[41m001\u001b[0m close                         \u001b[41m002\u001b[0m execute                       \u001b[41m003\u001b[0m executemany                   \u001b[41m004\u001b[0m executescript                 \n",
      "\u001b[41m005\u001b[0m fetchall                      \u001b[41m006\u001b[0m fetchmany                     \u001b[41m007\u001b[0m fetchone                      \u001b[41m008\u001b[0m setinputsizes                 \n",
      "\u001b[41m009\u001b[0m setoutputsize                 \n",
      "\u001b[41m                    constants                     \u001b[0m\n",
      "\u001b[41m001\u001b[0m arraysize                     \u001b[41m002\u001b[0m connection                    \u001b[41m003\u001b[0m description                   \u001b[41m004\u001b[0m lastrowid                     \n",
      "\u001b[41m005\u001b[0m row_factory                   \u001b[41m006\u001b[0m rowcount                      \n",
      "\n"
     ]
    }
   ],
   "source": [
    "aprint(classify(cur))"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### aprint(adoc(cur))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 31,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "If it is a callable object then you can assign a __name__ attribute to it.\n",
      "But the value assigned to __name__ must be the name of the callable object.\n",
      "If it is a callable object then you can assign a __name__ attribute to it.\n",
      "But the value assigned to __name__ must be the name of the callable object.\n",
      "If it is a callable object then you can assign a __name__ attribute to it.\n",
      "But the value assigned to __name__ must be the name of the callable object.\n",
      "\u001b[41m<sqlite3.Cursor object at 0x0000014D47E1E7A0>\u001b[0m SQLite database cursor class.\n",
      "\u001b[41m                     classess                     \u001b[0m\n",
      "\u001b[41m               function_or_methods                \u001b[0m\n",
      "\u001b[42mclose\u001b[0m\n",
      "    Closes the cursor.\n",
      "\u001b[42mexecute\u001b[0m\n",
      "    Executes a SQL statement.\n",
      "\u001b[42mexecutemany\u001b[0m\n",
      "    Repeatedly executes a SQL statement.\n",
      "\u001b[42mexecutescript\u001b[0m\n",
      "    Executes a multiple SQL statements at once. Non-standard.\n",
      "\u001b[42mfetchall\u001b[0m\n",
      "    Fetches all rows from the resultset.\n",
      "\u001b[42mfetchmany\u001b[0m\n",
      "    Fetches several rows from the resultset.\n",
      "\u001b[42mfetchone\u001b[0m\n",
      "    Fetches one row from the resultset.\n",
      "\u001b[42msetinputsizes\u001b[0m\n",
      "    Required by DB-API. Does nothing in pysqlite.\n",
      "\u001b[42msetoutputsize\u001b[0m\n",
      "    Required by DB-API. Does nothing in pysqlite.\n",
      "\u001b[41m                    constants                     \u001b[0m\n",
      "\u001b[42marraysize\u001b[0m\n",
      "    1\n",
      "\u001b[42mconnection\u001b[0m\n",
      "    <sqlite3.Connection object at 0x0000014D483FDB90>\n",
      "\u001b[42mdescription\u001b[0m\n",
      "    None\n",
      "\u001b[42mlastrowid\u001b[0m\n",
      "    None\n",
      "\u001b[42mrow_factory\u001b[0m\n",
      "    None\n",
      "\u001b[42mrowcount\u001b[0m\n",
      "    -1\n",
      "None\n",
      "\n"
     ]
    }
   ],
   "source": [
    "aprint(adoc(cur))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.7.3"
  },
  "toc": {
   "base_numbering": 1,
   "nav_menu": {},
   "number_sections": true,
   "sideBar": true,
   "skip_h1_title": false,
   "title_cell": "Table of Contents",
   "title_sidebar": "Contents",
   "toc_cell": false,
   "toc_position": {
    "height": "calc(100% - 180px)",
    "left": "10px",
    "top": "150px",
    "width": "206px"
   },
   "toc_section_display": true,
   "toc_window_display": true
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
